home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
text
/
dtp
/
PicCatalog211.lha
/
PicCatalog211.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1996-11-03
|
29KB
|
952 lines
/*--------------------------------------*/
/* $VER: PicCatalog V2.11 (03 Nov 1996) */
/* ©1996 Michael Merkel */
/*--------------------------------------*/
/*
how to use this:
----------------
1. open a new document
2. start this script
3. select a picture directory
4. select fixed or not fixed
(if you select fixed you _must_ specify the maximum size of a picture in the
#horizontal/#vertical textfields!
otherwise you _must_ specify the number of pictures in these fields!)
5. press "make"
comments to this program to:
----------------------------
mmerkel@rummelplatz.uni-mannheim.de
Regards...
Michael Merkel
*/
OPTIONS RESULTS
/* Make sure rexx support is opened */
IF ~SHOW('L','rexxsupport.library') THEN
CALL ADDLIB('rexxsupport.library',0,-30)
IF ~SHOW('L','softlogik:libs/slarexxsupport.library') THEN
CALL ADDLIB('softlogik:libs/slarexxsupport.library',0,-30)
ADDRESS 'PAGESTREAM'
/* defaults */
pcversion = 'V2.11'
formats = 'bmp gif iffilbm jpeg pcx pict tiff artexpressioneps dr2d eps iffilus illustratoreps pagestream3doc'
'GETPAGEMASTERPAGE MASTERPAGE mname'
if (RC = 10) then CALL DOERRORREQUESTER
defmeasure = GetDefaultMeasurementSystem()
'GETDIMENSIONS dim MASTERPAGE "'mname'"'
if (dim.orientation = 'PORTRAIT') then do
rpagesizex = dim.width
rpagesizey = dim.height
end
else do
rpagesizex = dim.height
rpagesizey = dim.width
end
measure = 'pt'
tf.0 = 'FALSE'
tf.1 = 'TRUE'
CALL ReadPrefs
/* get user choices */
CALL DOREQUESTER
if (ergebnis = cancelhandler)
then do
''defmeasure''
EXIT
end
CALL WritePrefs
/* transform to same measurement system */
pagesizex = rpagesizex
pagesizey = rpagesizey
leftgap = p2d(WORD(rgapsnsize,1),measure)
rightgap = p2d(WORD(rgapsnsize,2),measure)
topgap = p2d(WORD(rgapsnsize,3),measure)
bottomgap = p2d(WORD(rgapsnsize,4),measure)
gap = p2d(WORD(rgapsnsize,5),measure)
txtsize = p2d(WORD(rgapsnsize,6),measure)
startx = leftgap
starty = topgap
if (fps = 0)
then do
psx = (pagesizex-leftgap-rightgap-(numx-1)*gap) / numx
psy = (pagesizey-topgap-bottomgap-(numy-1)*gap-numy*txtsize) / numy
psf = psx / psy
anzp = numx * numy
end
else do
psx = p2d(numx,measure)
psy = p2d(numy,measure)
psf = psx / psy
end
if (Open('dump','T:PicCatalog.dumpfile','W') = 1) then do
wl=WriteLN('dump','DUMPFILE for PicCatalog '||pcversion||' - ©1996 Michael Merkel')
cl=Close('dump')
end
num = 0
nppp = 0
pagenumber = 1
maxheight = 0
/* draw border for first page */
CALL DrawPageBorder
BusyReq = OpenBusyMessage('getting pictures ...')
'REFRESH OFF'
dummy = RekDir(pdir)
if (nppp=0) then 'DELETEPAGE'
if ((nppp > 0) & (print = 1))
then do /* ready but not yet printed */
Call SetBusyMessage(BusyReq,'refreshing display...')
'REFRESH ON'
'REFRESHWINDOW'
CALL PrintPage
end
CALL CLEANUP
AddPicture:
ARG name
CALL DumpText('('||num||') '||name||' -> ',0)
do while (PlaceGraphic(name) > 0)
if (lastpic = 1)
then do /* last picture placed on page */
Call SetBusyMessage(BusyReq,'refreshing display...')
'REFRESH ON'
'REFRESHWINDOW'
if (print = 1) then CALL PrintPage
else 'DISPLAY PAGE NEXT'
pagenumber = pagenumber + 1
nppp = 0
CALL DrawPageBorder
'REFRESH OFF'
end
end
num = num + 1
RETURN
PlaceGraphic:
ARG name
CALL getbusy(name)
/* this prevents ARexx to show error messages (RC=10) if pictype is wrong */
OPTIONS FAILAT 11
pictype = 0
fileget = 0
document3 = 0
/* ----------------------------------------------------------------- pgs3 documents! */
if (WORD(lformats,WORDS(formats)) = 1)
then do
'CURRENTWINDOWPATH'
oldwinname = RESULT
'OPENDOCUMENT FILE "'name'" FILTER "IFFDOC"'
if (RC = 0)
then do
'REFRESH ON'
'OPENWINDOW "PICdumm" PAGE 1 SCALE "10%"'
if (BusyReq>0) then 'CLOSEBUSYREQUESTER 'BusyReq
'REFRESH OFF'
'GETPAGEMASTERPAGE MASTERPAGE mname2 DEPTH mwhere2'
mdisplayed = RESULT
'GETDIMENSIONS dim2 MASTERPAGE "'mname2'"'
if (dim2.orientation = 'PORTRAIT')
then do
px2 = dim2.width
py2 = dim2.height
end
else do
px2 = dim2.height
py2 = dim2.width
end
if mdisplayed = 'ON'
then do
'DISPLAY MPG RIGHT SCALE "10%"'
'SELECTOBJECT ALL'
'UNLOCK'
'TRANSFORM 1'
'MOVETOPAGE PAGE 1'
'DISPLAY PAGE 1 SCALE "10%"'
if mwhere2 = 'INBACK' then 'SENDTOBACK'
else 'SENDTOFRONT'
end
'DRAWBOX 0 0 'px2 py2
'SELECTOBJECT ALL'
'UNLOCK'
'CREATEDRAWING BEST'
'COPYOBJECT'
'CLOSEDOCUMENT FORCE'
'REVEALWINDOW WINDOW "'oldwinname'"'
'PASTEOBJECT'
fileget = 1
document3 = 1
BusyReq = OpenBusyMessage('placing document...')
end
end
/* ----------------------------------------------------------------- bitmaps! */
if fileget = 0
then do
do filegc = 1 to WORDS(formats)
if (WORD(lformats,filegc) = 1)
then do
'PLACEGRAPHIC FILE "'name'" FILTER "'WORD(formats,filegc)'" PROGRESS'
if (RC = 0)
then do
fileget = 1
LEAVE
end
end
end
end
/* ------------------------------------------------------------- endfiletypes */
OPTIONS FAILAT 10
if (fileget = 1)
then do
'GETOBJECT TYPE objtype'
SELECT
WHEN (objtype = 2 ) THEN pictype = 2
WHEN (objtype = 12) THEN pictype = 1
WHEN (objtype = 13) THEN pictype = 3
END
SELECT
WHEN (pictype = 1) THEN 'GETPICTURE POSITION 'posi
WHEN (pictype = 2) THEN 'GETDRAWING POSITION 'posi
WHEN (pictype = 3) THEN 'GETEPS POSITION 'posi
END
picid = RESULT
d1 = startx
d2 = starty
pwidth = posi.right - posi.left
pheight = posi.bottom - posi.top
if (fps=0)
then do
gsf = pwidth / pheight
if (gsf > psf) then factor = psx / pwidth
else factor = psy / pheight
newpwidth = factor * pwidth - 2
newpheight = factor * pheight - 2
centerdeltax = (psx - newpwidth) / 2
centerdeltay = (psy - newpheight) / 2
d3 = d1 + psx
d4 = d2 + psy
if ((d3 - 1) > (pagesizex - rightgap)) /* well, it's too far right! */
then do
startx = leftgap
starty = d4 + gap + txtsize
d1 = startx
d2 = starty
d3 = d1 + psx
d4 = d2 + psy
end
if ((d4 + txtsize - 1) > (pagesizey - bottomgap)) /* now it's too far down! */
then do
startx = leftgap
starty = topgap
lastpic = 1 /* last picture already placed! print or flip page and go on... */
'DELETEOBJECT OBJECTID 'picid
RETURN 1
end
startx = d3 + gap
newl = d1 + centerdeltax
newt = d2 + centerdeltay
newr = newl + newpwidth
newb = newt + newpheight
SELECT
WHEN (pictype = 1)
THEN 'EDITPICTURE POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
WHEN (pictype = 2)
THEN if (document3 = 1)
THEN 'EDITDRAWING POSITION 'newl newt newr newb' OBJECTID 'picid
else 'EDITDRAWING POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
OTHERWISE
'EDITEPS POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
END
end
else do
gsf = pwidth / pheight
if (gsf > psf) then factor = psx / pwidth
else factor = psy / pheight
newpwidth = factor * pwidth
newpheight = factor * pheight
d3 = d1 + newpwidth + 6
d4 = d2 + newpheight + 6
if ((d3 - 1) > (pagesizex - rightgap)) /* well, it's too far right! */
then do
startx = leftgap
starty = d2 + maxheight + 6 + gap + txtsize
d1 = startx
d2 = starty
d3 = d1 + newpwidth + 6
d4 = d2 + newpheight + 6
if ((d3 - 1) > (pagesizex - rightgap)) then call ErrorExit
maxheight = 0
end
if ((d4 + txtsize - 1) > (pagesizey - bottomgap)) /* now it's too far down! */
then do
startx = leftgap
starty = topgap
if ((starty + newpheight + 6 + txtsize - 1) > (pagesizey - bottomgap)) then call ErrorExit
maxheight = 0
lastpic = 1 /* last picture already placed! print or flip page and go on... */
'DELETEOBJECT OBJECTID 'picid
RETURN 1
end
if (newpheight > maxheight) then maxheight = newpheight
startx = d3 + gap
newl = d1 + 3
newt = d2 + 3
newr = d3 - 3
newb = d4 - 3
SELECT
WHEN (pictype = 1)
THEN 'EDITPICTURE POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
WHEN (pictype = 2)
THEN if (document3 = 1)
THEN 'EDITDRAWING POSITION 'newl newt newr newb' OBJECTID 'picid
else 'EDITDRAWING POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
OTHERWISE
'EDITEPS POSITION 'newl newt newr newb' stored "EXTERNAL" OBJECTID 'picid
END
end
if (txtsize > 0) then do
'DRAWTEXTOBJ 'd1 d4' INFRONT'
txtid = RESULT
'SELECTTEXT AT 'd1 d4' FRONTMOST'
'BEGINCOMMANDCAPTURE'
'SETTRACKTABLE NONE'
'SETLEADING RELATIVE 100%'
'SETTYPESIZE 'txtsize
'SETPARAGRAPHSTYLE "PicName"'
'ENDCOMMANDCAPTURE'
if (prname = 0) then 'INSERT "'name'"'
else do
name2 = reverse(name)
pos = pos('/',name2)
if (pos = 0) then pos = pos(':',name2)
name3 = right(name,pos-1)
'INSERT "'name3'"'
end
'GETTEXTOBJ POSITION txtpos OBJECTID 'txtid
txtp2.left = txtpos.left
txtp2.top = txtpos.top
txtp2.bottom = txtpos.bottom
txtp2.right = txtpos.right
txtwidth = txtp2.right - txtp2.left
if (txtwidth > (d3-d1)) then 'EDITTEXTOBJ POSITION 'txtp2.left txtp2.top d3 txtp2.bottom' OBJECTID 'txtid
end
'DRAWBOX 'd1 d2 d3 d4
'SETSTROKEWEIGHT 1pt'
nppp = nppp + 1
CALL DumpText('....created',1)
end
else CALL DumpText('....NOT created',1)
RETURN 0
DOREQUESTER:
filehandler = 0
ergebnis = filehandler
do until ((ergebnis = okhandler) | (ergebnis = cancelhandler))
'ALLOCAREXXREQUESTER "PicCatalog '||pcversion||' - ©1996 Michael Merkel" 350 280'
reqhandle = RESULT
'ADDAREXXGADGET 'reqhandle' EXIT 10 260 70 LABEL "_Make"'
okhandler = RESULT
'ADDAREXXGADGET 'reqhandle' EXIT 270 260 70 LABEL "_Cancel"'
cancelhandler = RESULT
'ADDAREXXGADGET 'reqhandle' EXIT 115 260 120 LABEL "_Print Settings"'
pprefshandler = RESULT
'ADDAREXXGADGET 'reqhandle' STRING 215 5 55 STRING "'numx'" LABEL "# of pictures horizontal:"'
numx_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' STRING 215 20 55 STRING "'numy'" LABEL "# of pictures vertical: "'
numy_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' CHECKBOX 280 15 10 CHECKED "'tf.fps'" LABEL "fixed"'
fps_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' TEXT 10 40 112 STRING "page offsets:"'
'ADDAREXXGADGET 'reqhandle' STRING 63 60 70 STRING "'WORD(rgapsnsize,1)'" LABEL "left:"'
rleftgap_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' STRING 63 75 70 STRING "'WORD(rgapsnsize,2)'" LABEL "right:"'
rrightgap_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' STRING 200 60 70 STRING "'WORD(rgapsnsize,3)'" LABEL "top:"'
rtopgap_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' STRING 200 75 70 STRING "'WORD(rgapsnsize,4)'" LABEL "bottom:"'
rbottomgap_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' STRING 183 100 50 STRING "'WORD(rgapsnsize,5)'" LABEL "gap between pictures:"'
rgap_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' STRING 183 120 50 STRING "'WORD(rgapsnsize,6)'" LABEL "textsize (0 = none): "'
rtxtsize_gadget = RESULT
'ALLOCAREXXLIST'
rexxlist = RESULT
'ADDAREXXLIST 'rexxlist' "full path"'
'ADDAREXXLIST 'rexxlist' "name only"'
'ADDAREXXGADGET 'reqhandle' CYCLE 240 120 100'
prname_gadget = RESULT
'SETAREXXGADGET 'reqhandle' 'prname_gadget' LIST 'rexxlist' CURRENT 'prname
'ADDAREXXGADGET 'reqhandle' STRING 10 150 300 STRING "'pdir'" LABEL "picture path:" LABELPOS "ABOVELEFT"'
pdir_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' EXIT 315 150 10 LABEL "_?"'
filehandler = RESULT
'ADDAREXXGADGET 'reqhandle' CHECKBOX 10 170 10 CHECKED "'tf.lreku'" LABEL "do directories recursive"'
lreku_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' EXIT 115 195 120 LABEL "_Type Settings"'
ptypehandler = RESULT
'ADDAREXXGADGET 'reqhandle' CHECKBOX 10 230 10 CHECKED "'tf.print'" LABEL "print every single page"'
print_gadget = RESULT
'ADDAREXXGADGET 'reqhandle' TEXT 30 240 240 STRING "(instead of collecting them)"'
'DOAREXXREQUESTER 'reqhandle
ergebnis = RESULT
'GETAREXXGADGET 'reqhandle' 'numx_gadget' STRING'
numx = RESULT
'GETAREXXGADGET 'reqhandle' 'numy_gadget' STRING'
numy = RESULT
'GETAREXXGADGET 'reqhandle' 'rleftgap_gadget' STRING'
rgapsnsize = SPACE(RESULT,0)
'GETAREXXGADGET 'reqhandle' 'rrightgap_gadget' STRING'
rgapsnsize = rgapsnsize SPACE(RESULT,0)
'GETAREXXGADGET 'reqhandle' 'rtopgap_gadget' STRING'
rgapsnsize = rgapsnsize SPACE(RESULT,0)
'GETAREXXGADGET 'reqhandle' 'rbottomgap_gadget' STRING'
rgapsnsize = rgapsnsize SPACE(RESULT,0)
'GETAREXXGADGET 'reqhandle' 'rgap_gadget' STRING'
rgapsnsize = rgapsnsize SPACE(RESULT,0)
'GETAREXXGADGET 'reqhandle' 'rtxtsize_gadget' STRING'
rgapsnsize = rgapsnsize SPACE(RESULT,0)
'GETAREXXGADGET 'reqhandle' 'prname_gadget' CURRENT'
prname = RESULT
'GETAREXXGADGET 'reqhandle' 'pdir_gadget' STRING'
pdir = RESULT
'GETAREXXGADGET 'reqhandle' 'lreku_gadget' CHECKED'
lreku = RESULT
'GETAREXXGADGET 'reqhandle' 'print_gadget' CHECKED'
print = RESULT
'GETAREXXGADGET 'reqhandle' 'fps_gadget' CHECKED'
fps = RESULT
'FREAREXXLIST 'rexxlist
'FREEAREXXREQUESTER 'reqhandle
if (ergebnis = filehandler) then do
'GETFILEPATH TITLE "please choose the picture path" PATH "'pdir'"'
if (RC=0) then pdir = result
end
if (ergebnis = pprefshandler) then CALL PrintSettings
if (ergebnis = ptypehandler) then CALL PicTypeSettings
end
if (right(pdir,1) ~= ':') then
if (right(pdir,1) ~= '/') then pdir = pdir||'/'
RETURN
PrintSettings:
'ALLOCAREXXREQUESTER "Please set the settings for printing ..." 230 80'
reqhandle2 = RESULT
'ADDAREXXGADGET 'reqhandle2' EXIT 10 60 70 LABEL "_Ok"'
okhandler2 = RESULT
'ADDAREXXGADGET 'reqhandle2' EXIT 150 60 70 LABEL "_Cancel"'
cancelhandler2 = RESULT
'ALLOCAREXXLIST'
rexxlist2 = RESULT
'ADDAREXXLIST 'rexxlist2' "Grayscale"'
'ADDAREXXLIST 'rexxlist2' "Color"'
'ADDAREXXGADGET 'reqhandle2' CYCLE 75 10 100 LABEL "Method:"'
prmethod_gadget = RESULT
'SETAREXXGADGET 'reqhandle2' 'prmethod_gadget' LIST 'rexxlist2' CURRENT 'prmethod
'ALLOCAREXXLIST'
rexxlist3 = RESULT
'ADDAREXXLIST 'rexxlist3' "Actual Size"'
'ADDAREXXLIST 'rexxlist3' "Scale To Fit"'
'ADDAREXXGADGET 'reqhandle2' CYCLE 75 30 130 LABEL "Scale:"'
prscale_gadget = RESULT
'SETAREXXGADGET 'reqhandle2' 'prscale_gadget' LIST 'rexxlist3' CURRENT 'prscale
'DOAREXXREQUESTER 'reqhandle2
ergebnis2 = RESULT
if (ergebnis2 = okhandler2)
then do
'GETAREXXGADGET 'reqhandle2' 'prmethod_gadget' CURRENT'
prmethod = RESULT
'GETAREXXGADGET 'reqhandle2' 'prscale_gadget' CURRENT'
prscale = RESULT
end
'FREAREXXLIST 'rexxlist2
'FREAREXXLIST 'rexxlist3
'FREEAREXXREQUESTER 'reqhandle2
RETURN
PicTypeSettings:
xformats = lformats /* merken der alten werte */
ergebnis3 = 1
do until ((ergebnis3 = okhandler3) | (ergebnis3 = cancelhandler3))
'ALLOCAREXXREQUESTER "Specify the picture types which should be loaded ..." 380 200'
reqhandle3 = RESULT
'ADDAREXXGADGET 'reqhandle3' EXIT 10 180 70 LABEL "_Ok"'
okhandler3 = RESULT
'ADDAREXXGADGET 'reqhandle3' EXIT 300 180 70 LABEL "_Cancel"'
cancelhandler3 = RESULT
'ALLOCAREXXLIST'
rexxlist3src = RESULT
'ALLOCAREXXLIST'
rexxlist3dst = RESULT
dc = 0
sc = 0
do i = 1 to WORDS(formats)
if WORD(xformats,i) = 1
then do
'ADDAREXXLIST 'rexxlist3dst' "'WORD(formats,i)'"'
dc = dc + 1
d.dc = i
end
else do
'ADDAREXXLIST 'rexxlist3src' "'WORD(formats,i)'"'
sc = sc + 1
s.sc = i
end
end
'ADDAREXXGADGET 'reqhandle3' SCROLLIST 10 20 160 150 LABEL "Available:" LABELPOS "ABOVELEFT"'
srclist3 = RESULT
'SETAREXXGADGET 'reqhandle3 srclist3' LIST 'rexxlist3src
'ADDAREXXGADGET 'reqhandle3' SCROLLIST 210 20 160 150 LABEL "Types to load:" LABELPOS "ABOVELEFT"'
dstlist3 = RESULT
'SETAREXXGADGET 'reqhandle3 dstlist3' LIST 'rexxlist3dst
'ADDAREXXGADGET 'reqhandle3' EXIT 177 80 24 LABEL "--_>"'
godst3 = RESULT
'ADDAREXXGADGET 'reqhandle3' EXIT 177 100 24 LABEL "_<--"'
gosrc3 = RESULT
'DOAREXXREQUESTER 'reqhandle3
ergebnis3 = RESULT
if (ergebnis3 = godst3)
then do
'GETAREXXGADGET 'reqhandle3 srclist3' CURRENT'
snum = RESULT
if (snum >= 0)
then do
snum = snum + 1
xformats = DELWORD(xformats,s.snum,1)
xformats = INSERT('1 ',xformats, 2*s.snum-2)
end
end
if (ergebnis3 = gosrc3)
then do
'GETAREXXGADGET 'reqhandle3 dstlist3' CURRENT'
dnum = RESULT
if (dnum >= 0)
then do
dnum = dnum + 1
xformats = DELWORD(xformats,d.dnum,1)
xformats = INSERT('0 ',xformats, 2*d.dnum-2)
end
end
'FREAREXXLIST 'rexxlist3src
'FREAREXXLIST 'rexxlist3dst
'FREEAREXXREQUESTER 'reqhandle3
end
if (ergebnis3 = okhandler3)
then lformats = xformats
RETURN
DOERRORREQUESTER:
'ALLOCAREXXREQUESTER "Error!" 300 50'
reqhandle = RESULT
'ADDAREXXGADGET 'reqhandle' EXIT 115 30 70 LABEL "_Ok"'
dummy = RESULT
'ADDAREXXGADGET 'reqhandle' TEXT 10 10 280 STRING "Please open a new document first!"'
'DOAREXXREQUESTER 'reqhandle
dummy = RESULT
'FREEAREXXREQUESTER 'reqhandle
exit
RETURN
ErrorExit:
'ALLOCAREXXREQUESTER "FATAL ERROR!" 330 70'
reqhandle = RESULT
'ADDAREXXGADGET 'reqhandle' EXIT 115 50 70 LABEL "_Ok"'
dummy = RESULT
'ADDAREXXGADGET 'reqhandle' TEXT 10 10 300 STRING "Picturesize is too big!"'
'ADDAREXXGADGET 'reqhandle' TEXT 10 30 300 STRING "Please restart with smaller size!"'
'DOAREXXREQUESTER 'reqhandle
dummy = RESULT
'FREEAREXXREQUESTER 'reqhandle
call CLEANUP
EXIT
SetBusyMessage:
ARG BReq,BMess
'SETBUSYREQUESTER 'BReq' MESSAGE "'BMess'"'
RETURN
OpenBusyMessage:
ARG BMess
BReq = 0
'OPENBUSYREQUESTER MESSAGE "'BMess'" THERMOMETER DISABLED ABORT ENABLED'
BReq=result
RETURN BReq
GETBUSY:
ARG messname
if (length(messname) > 27)
then mess = '...'||right(messname,25)
else mess = messname
Call SetBusyMessage(BusyReq,mess)
'GETBUSYREQUESTER 'BusyReq
if (result=1) then do
if (nppp = 0) then do
'SELECTOBJECT ALL'
'DELETEOBJECT'
'DISPLAY PAGE PREVIOUS'
end
CALL CLEANUP
end
RETURN
CLEANUP:
if (BusyReq>0) then 'CLOSEBUSYREQUESTER 'BusyReq
cl = Close('flist')
cl = Close('dlist')
ADDRESS COMMAND 'C:Delete >NIL: T:PicCatalog#?.tmp QUIET'
/* reset the measurementsystem to the saved one!! */
''defmeasure''
'REFRESH ON'
'REFRESHWINDOW'
EXIT
ReadPrefs:
ok = Open('Prefs','PageStream3:Scripts/PicCatalog.prefs','R')
if (ok = 1)
then do
dummy = ReadLn('Prefs')
if (right(dummy,4) >= '2.11')
then do
say 'correct version! reading old prefs...'
pdir = ReadLN('Prefs')
lreku = ReadLN('Prefs')
rgapsnsize = ReadLN('Prefs')
numx = ReadLN('Prefs')
numy = ReadLN('Prefs')
fps = ReadLN('Prefs')
prname = ReadLN('Prefs')
lformats = ReadLN('Prefs')
print = ReadLN('Prefs')
prmethod = ReadLN('Prefs')
prscale = ReadLN('Prefs')
pcpread = 1
end
else do
pcpread = 0
say 'old prefsfile detected! -> default values'
pdir = '!OLD PREFSFILE -> USING DEFAULTS!'
end
cl = Close('Prefs')
end
else do
pcpread = 0
say 'no prefsfile! -> default values'
pdir = '!NO PREFS FOUND -> USING DEFAULTS!'
end
if (pcpread = 0)
then do
lreku = 0
rgapsnsize = '2cm 2cm 2cm 2.5cm 5mm 6pt'
numx = 3
numy = 4
fps = 0
prname = 0
lformats = STRIP(COPIES('1 ',WORDS(formats)))
print = 0
prmethod = 0
prscale = 0
end
RETURN
WritePrefs:
ok = Open('Prefs','PageStream3:Scripts/PicCatalog.prefs','W')
if (ok = 1) then do
say 'writing prefs...'
WriteLN('Prefs','PCP'||pcversion)
WriteLN('Prefs',pdir)
WriteLN('Prefs',lreku)
WriteLN('Prefs',rgapsnsize)
WriteLN('Prefs',numx)
WriteLN('Prefs',numy)
WriteLN('Prefs',fps)
WriteLN('Prefs',prname)
WriteLN('Prefs',lformats)
WriteLN('Prefs',print)
WriteLN('Prefs',prmethod)
WriteLN('Prefs',prscale)
cl = Close('Prefs')
end
else do
say 'error writing prefs file "PicCatalog.prefs"'
end
RETURN
DrawPageBorder:
d1 = leftgap - 5
d2 = topgap - 5
d3 = pagesizex-rightgap + 5
d4 = pagesizey-bottomgap + 5
'DRAWBOX 'd1 d2 d3 d4
'SETSTROKEWEIGHT 3pt'
d4 = d4 + 2
'DRAWTEXTOBJ 'd1 d4' INFRONT'
txtid = RESULT
'SELECTTEXT AT 'd1 d4' FRONTMOST'
bottomtxtsize = 12
bottomtwidth = d3 - d1
'BEGINCOMMANDCAPTURE'
'SETTRACKTABLE NONE'
'SETLEADING RELATIVE 100%'
'SETTYPESIZE "'bottomtxtsize'"'
'ENDCOMMANDCAPTURE'
'INSERT "PicCatalog '||pcversion||' - ©1996 Michael Merkel"'
'SETTABRULER "RIGHT" 'bottomtwidth
'INSERTCONTROL TAB'
'INSERT "Page 'pagenumber'"'
RETURN
RekDir:
PROCEDURE EXPOSE measure num numx numy anzp leftgap topgap rightgap bottomgap pagesizex pagesizey psf psx psy gap txtsize lreku BusyReq print prname prmethod prscale defmeasure pcversion startx starty lastpic pagenumber nppp fps maxheight formats lformats
ARG dir
ADDRESS COMMAND 'C:list dir="'||dir||'" LFORMAT="%F%N" FILES >T:PicCatalogFilesUS.tmp'
if (GetLength('T:PicCatalogFilesUS.tmp') = 0)
then ADDRESS COMMAND 'C:Copy T:PicCatalogFilesUS.tmp TO T:PicCatalogFilesS.tmp'
else do
ADDRESS COMMAND 'C:Sort FROM T:PicCatalogFilesUS.tmp TO T:PicCatalogFilesS.tmp'
CALL WorkFileList
end
ADDRESS COMMAND 'C:Delete >NIL: T:PicCatalogFilesUS.tmp T:PicCatalogFilesS.tmp QUIET'
if (lreku = 1) then do
ADDRESS COMMAND 'C:List dir="'||dir||'" LFORMAT="%F%N" DIRS >T:PicCatalogDirsUS.tmp'
if (GetLength('T:PicCatalogDirsUS.tmp') = 0)
then ADDRESS COMMAND 'C:Copy T:PicCatalogDirsUS.tmp TO T:PicCatalogDirsS.tmp'
else do
ADDRESS COMMAND 'C:Sort FROM T:PicCatalogDirsUS.tmp TO T:PicCatalogDirsS.tmp'
CALL WorkDirList
end
end
RETURN 0
WorkFileList:
PROCEDURE EXPOSE measure num numx numy anzp leftgap topgap rightgap bottomgap pagesizex pagesizey psf psx psy gap txtsize lreku BusyReq print prname prmethod prscale defmeasure pcversion startx starty lastpic pagenumber nppp fps maxheight formats lformats
fnum = 0
if (Open('flist','t:PicCatalogFilesS.tmp','R') ~= 1) then do
say 'Fehler beim Öffnen des File-TmpFiles!!!'
exit
end
do while (eof('flist') = 0)
named = readln('flist')
if (eof('flist') = 0) then do
name.fnum = named
fnum = fnum + 1
end
end
cl = Close('flist')
do k = 0 to fnum-1
CALL AddPicture(name.k)
end
RETURN
WorkDirList:
PROCEDURE EXPOSE measure num numx numy anzp leftgap topgap rightgap bottomgap pagesizex pagesizey psf psx psy gap txtsize lreku BusyReq print prname prmethod prscale defmeasure pcversion startx starty lastpic pagenumber nppp fps maxheight formats lformats
ad = 0
if(Open('dlist','t:PicCatalogDirsS.tmp','R') ~= 1) then do
say 'Fehler beim Öffnen des DIR-TmpFiles!!!'
exit
end
do while (eof('dlist') = 0)
name = readln('dlist')
if (eof('dlist') = 0) then do
dirname.ad = name
ad = ad + 1
end
end
cl = Close('dlist')
ADDRESS COMMAND 'C:Delete >NIL: T:PicCatalogDirsUS.tmp T:PicCatalogDirsS.tmp QUIET'
do k = 0 to ad-1
CALL RekDir(dirname.k)
end
RETURN
GetLength:
PROCEDURE EXPOSE BusyReq
ARG filename
ADDRESS COMMAND 'C:List 'filename' LFORMAT="%l" >T:PicCatalogLength.tmp'
if (Open('flength','T:PicCatalogLength.tmp','R') = 1) then do
l = ReadLN('flength')
cl = Close('flength')
ADDRESS COMMAND 'C:Delete >NIL: T:PicCatalogLength.tmp QUIET'
if (compare(l,'empty') = 0)
then return 0
else return l
end
else return 0
RETURN ll
DumpText:
ARG dumptxt,dumpmode
if (Open('dump','T:PicCatalog.dumpfile','A') = 1) then do
if dumpmode = 0 then wl = WriteCH('dump',dumptxt)
else wl = WriteLN('dump',dumptxt)
cl = Close('dump')
end
RETURN
PrintPage:
output.0 = 'GRAYSCALE'
output.1 = 'COLOR'
if (Open('dump','T:PicCatalog.dumpfile','A') = 1) then do
WriteLN('dump','printing page')
cl = Close('dump')
end
Call SetBusyMessage(BusyReq,'printing page...')
if (prscale = 0) then do
'PRINTDOCUMENT PAGE "" OUTPUT 'output.prmethod' SCALE "ACTUAL"'
end
if (prscale = 1) then do
'PRINTDOCUMENT PAGE "" OUTPUT 'output.prmethod' SCALE "FULLPAGE"'
end
'SELECTOBJECT ALL'
'DELETEOBJECT'
RETURN
GetDefaultMeasurementSystem:
PROCEDURE
'GETMEASUREMENTS COORDINATE stemc RELATIVE rel TEXT tex FROM fro'
st = 'SETMEASUREMENTS COORDINATE 'stemc.horizontal stemc.vertical' RELATIVE 'rel' TEXT 'tex' FROM 'fro
'SETMEASUREMENTS COORDINATE POINTS SAMEAS RELATIVE SAMEAS TEXT POINTS FROM PAGE'
RETURN st